package util.apps.gump;
import java.awt.*;
import java.util.regex.*;
import javax.swing.*;

public class Option{
	private String flag;
	private String description;
	private String userInput;
	private JTextField userInputS;
	private JTextArea flagS;
	private JTextArea descriptionS;
	public static final Pattern space = Pattern.compile("\\s+");

	public Option (String line){
		Matcher mat = space.matcher(line);
		if (mat.find()){
			flag = line.substring(0,2);
			description = line.substring(mat.end());
		}
	}
	
	public void makeSwingComponents(){
		userInputS = new JTextField();
		userInputS.setFont(GumpApplicationPanel.FONT);
		userInputS.setColumns(10);
		
		flagS = new JTextArea(flag);
		flagS.setFont(GumpApplicationPanel.FONT);
		flagS.setEditable(false);
		
		descriptionS = new JTextArea(description);
		descriptionS.setFont(GumpApplicationPanel.FONT);
		descriptionS.setEditable(false);
	}

	public String toString(){
		if (userInput == null) return flag+" "+description;
		else return flag+" "+description+"\n\t"+userInput;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public String getNotes() {
		return description;
	}

	public void setNotes(String notes) {
		this.description = notes;
	}

	public String getUserInput() {
		return userInput;
	}

	public void setUserInput(String userInput) {
		this.userInput = userInput;
	}

	public static Pattern getSpace() {
		return space;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public JTextField getUserInputS() {
		return userInputS;
	}

	public void setUserInputS(JTextField userInputS) {
		this.userInputS = userInputS;
	}

	public JTextArea getFlagS() {
		return flagS;
	}

	public void setFlagS(JTextArea flagS) {
		this.flagS = flagS;
	}

	public JTextArea getDescriptionS() {
		return descriptionS;
	}

	public void setDescriptionS(JTextArea descriptionS) {
		this.descriptionS = descriptionS;
	}

}
